using UnityEngine;

namespace GameToolkit
{
    /// <summary>
    /// 自定义渲染组件
    /// </summary>
    public interface IRenderer
    {
        Material material { get; set; }
    }

    /// <summary>
    /// 自定义渲染组件
    /// </summary>
    public abstract class CustomRenderer : MonoBehaviour, IRenderer
    {
        [SerializeField]
        Material m_Material;

        public Material material
        {
            get { return m_Material; }
            set
            {
                if(m_Material != value)
                {
                    m_Material = value;
                    OnValidateMaterial();
                }
            }
        }

        protected virtual void OnValidateMaterial() { }
    }
}
